<template>
	<view class="contents" :style="'height:'+screenHeight+'px;'">

		<view class="none" v-if="show">
			<view class="coent">
				<u-empty text="暂无报告" mode="list" icon-size="200">
				</u-empty>
			</view>
		</view>
		
		<view class="conentaa" v-else>
			<movable-area scale-area>
				<movable-view direction="all" @scale="onScale" scale="true" scale-min="1" scale-max="4"
					:scale-value="scale">
					<image style="width: 200%;" :src="'data:image/png;base64,'+dataUrl" mode="widthFix"></image>
				</movable-view>
			</movable-area>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				main: '',
				jianyival: '',
				screenHeight: getApp().globalData.screenHeight - 44,
				dataUrl: '',
			}
		},
		onLoad: function(option) {

			this.main = option.e
			console.log("特检", this.main)
			this.list()
		},
		methods: {

			list() {
				uni.showLoading({
					title: '请稍后',
					mask: true
				});
				this.$request("xzfx", "pacstejian", {
					main: this.main
				}).then(res => {
					console.log("报告查询", res)
					if (res.code == 1) {
						this.dataUrl = res.data.resultdata.data
						this.show = false
						uni.hideLoading();
					} else {
						this.show = true
						uni.hideLoading();
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				}).catch(err => {
					this.show = true
					uni.hideLoading();
					console.log("err", err)
					uni.showToast({
						title: err,
						icon: 'none',
						duration: 1000
					});
				});
			}
		}
	}
</script>

<style>
	movable-view {
		display: flex;
		justify-content: center;
		width: 100%;
		height:100%;
	}
	
	movable-area {
		height: 100%;
		width: 100%;
		position:fixed;
		overflow: hidden;
	}
		
	movable-view image{
		width:100%;
	}

	@import './bgcx.css';
</style>